import {defineStore} from 'pinia';
import {CacheUtil} from "@/utils/cacheUtil.js";
const appStore = defineStore('appStore',{
    state: () => ({
        sidebar: {
            opened: true,
        },
        topNav: {
            opened: CacheUtil.getSystemSetting()?.topNav,
        }
    }),
    getters: {
        getSidebar() {
            return this.sidebar.opened;
        },
        getTopNav() {
            return this.topNav.opened;
        },
    },
    actions: {
        toggleSidebar(data) {
            this.sidebar.opened = data;
        },
        toggleTopNav(data) {
            this.topNav.opened = data;
        },
    }
});

export default appStore;